package com.heima.admin;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.context.annotation.Bean;
/**
 * @projectName: heima-leadnews0802
 * @package: com.heima.admin
 * @className: AdminApplication
 * @author: pangyong
 * @description:
 * @date: 2023/8/2 9:58
 * @version: 1.0
 */
@SpringBootApplication
@MapperScan("com.heima.admin.mapper")
@EnableDiscoveryClient
@EnableFeignClients(basePackages = "com.heima.apis")
@EnableScheduling       //开启定时任务
public class AdminApplication {
    public static void main(String[] args) {
        SpringApplication.run(AdminApplication.class,args);
    }

    /**
     * 分页拦截器  庞泳
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }
}
